#ifndef LIST_H_
#define LIST_H_

#ifdef __cplusplus
extern "C" {
#endif

#include "base.h"
#include "node.h"

#define LIST_INIT_SIZE	100
#define LISTINCREMENT	10

typedef struct {
    ElemType *	elem;
    int			length;
    int			listsize;
} SequenceList, *PSequenceList;

typedef BOOL ( *compare ) ( ElemType *e1, ElemType *e2 );
typedef BOOL ( *visit ) ( ElemType *e );

BOOL equal( ElemType *e1, ElemType *e2 );
BOOL output( ElemType *e );

Status SequenceListInit( PSequenceList L );
Status SequenceListDestory( PSequenceList L );
Status SequenceListClear( PSequenceList L );
BOOL SequenceListEmpty( PSequenceList L );
int SequenceListLength( PSequenceList L );
Status SequenceListGetElem( PSequenceList L, int i, ElemType *pElem );
int SequenceListLocateElem( PSequenceList L, ElemType e, compare pFunc );
Status SequenceListInsert( PSequenceList L, int i, ElemType e );
Status SequenceListDelete( PSequenceList L, int i, ElemType *pElem );
Status SequenceListPriorElem( PSequenceList L, ElemType cur_e, ElemType *ppre_e );
Status SequenceListNextElem( PSequenceList L, ElemType cur_e, ElemType *pnext_e );
int SequenceListVisitAllElem( PSequenceList L, visit pCallBack );

void SequenceListUnion( PSequenceList La, PSequenceList Lb );
void SequenceListMerge( PSequenceList La, PSequenceList Lb, PSequenceList Lc );

#ifdef __cplusplus
}
#endif

#endif